package com.adcc.monitoragent.bean;

import java.util.ArrayList;
import java.util.List;

/**
 * ip + port 唯一确定 集群监控
 * 
 * @author charlie
 * 
 */
public class ZookeeperBean extends BaseBean {
	private static final long serialVersionUID = 1L;
	/**
	 * 固定窜
	 */
	private String fixType = "zk";
	private String port;// 端口
	private String version;// 版本号
	private String conf;// 节点配置
	private String latency;// 性能
	private String received;// 接收数据
	private String sent;// 发送数据
	private String outstanding;// 未发送数据
	private String state = "";// 主备用状态
	private String count;// 计数器
	private List<String> clients = new ArrayList<String>();// 客户端连接

	public ZookeeperBean() {
		super();
	}

	public ZookeeperBean(String key) {
		super();
		String[] temp = key.split(":");
		if(temp.length == 2) {
			this.ip = temp[0];
			this.port = temp[1];
		}
	}
	
	public String getPort() {
		return port;
	}

	public void setPort(String port) {
		this.port = port;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public String getConf() {
		return conf;
	}

	public void setConf(String conf) {
		this.conf = conf;
	}

	public String getLatency() {
		return latency;
	}

	public void setLatency(String latency) {
		this.latency = latency;
	}

	public String getReceived() {
		return received;
	}

	public void setReceived(String received) {
		this.received = received;
	}

	public String getSent() {
		return sent;
	}

	public void setSent(String sent) {
		this.sent = sent;
	}

	public String getOutstanding() {
		return outstanding;
	}

	public void setOutstanding(String outstanding) {
		this.outstanding = outstanding;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getCount() {
		return count;
	}

	public void setCount(String count) {
		this.count = count;
	}

	public List<String> getClients() {
		return clients;
	}

	@Override
	public String toString() {
		return "ZookeeperBean [fixType=" + fixType + ", port=" + port
				+ ", version=" + version + ", conf=" + conf + ", latency="
				+ latency + ", received=" + received + ", sent=" + sent
				+ ", outstanding=" + outstanding + ", state=" + state
				+ ", count=" + count + ", clients=" + clients + "]";
	}

	/**
	 * 获取关键字唯一标识
	 * @return
	 */
	public String buildKey() {
		return this.ip + ":" + this.port;
	}
	public String getFixType() {
		return fixType;
	}
	/**
	 * 获取展现名称   ip_port
	 */
	public void setShowName() {
		setShowName("Zookeeper");
	}
}
